home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / what's new / development kits / mac os / security sdk / includes / urlaccess.p < prev   
Encoding:
Text File  |  1999-10-28  |  8.7 KB  |  265 lines

  1. {
  2.      File:        URLAccess.p
  3.  
  4.      Contains:    URL Access Pascal interfaces.
  5.  
  6.      Version:    2.0
  7.  
  8.      Copyright:    (c) 1998-1999 by Apple Computer, Inc., all rights reserved
  9.  
  10.      Bugs?:        Please include the the file and version information (from above) with
  11.                  the problem description.  Developers belonging to one of the Apple
  12.                  developer programs can submit bug reports to:
  13.  
  14.                      devsupport@apple.com
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT URLAccess;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __URLACCESS__}
  27. {$SETC __URLACCESS__ := 1}
  28.  
  29. {$I+}
  30. {$SETC URLAccessIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __MACTYPES__}
  34. {$I MacTypes.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __FILES__}
  37. {$I Files.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __CODEFRAGMENTS__}
  40. {$I CodeFragments.p}
  41. {$ENDC}
  42. {$IFC UNDEFINED __FILESIGNING__}
  43. {$I FileSigning.p}
  44. {$ENDC}
  45.  
  46. { Data structures and types }
  47.  
  48. {$PUSH}
  49. {$ALIGN MAC68K}
  50. {$LibExport+}
  51.  
  52.  
  53. TYPE
  54.     URLReference = ^LONGINT; { an opaque 32-bit type }
  55.  
  56.  
  57. CONST
  58.     kURLReplaceExistingFlag        = $01;
  59.     kURLBinHexFileFlag            = $02;                            {  Binhex before uploading if necessary }
  60.     kURLExpandFileFlag            = $04;                            {  Use StuffIt engine to expand file if necessary }
  61.     kURLDisplayProgressFlag        = $08;
  62.     kURLDisplayAuthFlag            = $10;                            {  Display auth dialog if guest connection fails }
  63.     kURLUploadFlag                = $20;                            {  Do an upload instead of a download }
  64.     kURLIsDirectoryHintFlag        = $40;                            {  Hint: the URL is a directory }
  65.     kURLDoNotTryAnonymousFlag    = $80;                            {  Don't try to connect anonymously before getting logon info }
  66.     kURLDirectoryListingFlag    = $0100;                        {  Download the directory listing, not the whole directory }
  67.     kURLExpandAndVerifyFlag        = $0200;                        {  Expand file and then verify using signature resource }
  68.     kURLNoAutoRedirectFlag        = $0400;                        {  Do not automatically redirect to new URL }
  69.     kURLDebinhexOnlyFlag        = $0800;                        {  Do not use Stuffit Expander - just internal debinhex engine }
  70.     kURLReservedFlag            = $80000000;                    {  reserved for Apple internal use }
  71.  
  72.  
  73. TYPE
  74.     URLOpenFlags                        = UInt32;
  75.  
  76. CONST
  77.     kURLNullState                = 0;
  78.     kURLInitiatingState            = 1;
  79.     kURLLookingUpHostState        = 2;
  80.     kURLConnectingState            = 3;
  81.     kURLResourceFoundState        = 4;
  82.     kURLDownloadingState        = 5;
  83.     kURLDataAvailableState        = $15;
  84.     kURLTransactionCompleteState = 6;
  85.     kURLErrorOccurredState        = 7;
  86.     kURLAbortingState            = 8;
  87.     kURLCompletedState            = 9;
  88.     kURLUploadingState            = 10;
  89.  
  90.  
  91. TYPE
  92.     URLState                            = UInt32;
  93.  
  94. CONST
  95.     kURLInitiatedEvent            = 1;
  96.     kURLResourceFoundEvent        = 4;
  97.     kURLDownloadingEvent        = 5;
  98.     kURLAbortInitiatedEvent        = 8;
  99.     kURLCompletedEvent            = 9;
  100.     kURLErrorOccurredEvent        = 7;
  101.     kURLDataAvailableEvent        = $15;
  102.     kURLTransactionCompleteEvent = 6;
  103.     kURLUploadingEvent            = 10;
  104.     kURLSystemEvent                = 29;
  105.     kURLPercentEvent            = 30;
  106.     kURLPeriodicEvent            = 31;
  107.     kURLPropertyChangedEvent    = 32;
  108.  
  109.  
  110. TYPE
  111.     URLEvent                            = UInt32;
  112.  
  113. CONST
  114.     kURLInitiatedEventMask        = $01;
  115.     kURLResourceFoundEventMask    = $08;
  116.     kURLDownloadingMask            = $10;
  117.     kURLUploadingMask            = $0200;
  118.     kURLAbortInitiatedMask        = $80;
  119.     kURLCompletedEventMask        = $0100;
  120.     kURLErrorOccurredEventMask    = $40;
  121.     kURLDataAvailableEventMask    = $00100000;
  122.     kURLTransactionCompleteEventMask = $20;
  123.     kURLSystemEventMask            = $10000000;
  124.     kURLPercentEventMask        = $20000000;
  125.     kURLPeriodicEventMask        = $40000000;
  126.     kURLPropertyChangedEventMask = $80000000;
  127.     kURLAllBufferEventsMask        = $00100020;
  128.     kURLAllNonBufferEventsMask    = $E00003D1;
  129.     kURLAllEventsMask            = $FFFFFFFF;
  130.  
  131.  
  132. TYPE
  133.     URLEventMask                        = UInt32;
  134.     URLCallbackInfoPtr = ^URLCallbackInfo;
  135.     URLCallbackInfo = RECORD
  136.         version:                UInt32;
  137.         urlRef:                    URLReference;
  138.         property:                ConstCStringPtr;
  139.         currentSize:            UInt32;
  140.         systemEvent:            EventRecordPtr;
  141.     END;
  142.  
  143. {  http and https properties }
  144. {  authentication type flags }
  145.  
  146. CONST
  147.     kUserNameAndPasswordFlag    = $00000001;
  148.  
  149. FUNCTION URLGetURLAccessVersion(VAR returnVers: UInt32): OSStatus;
  150. {$IFC TARGET_RT_MAC_CFM }
  151. {
  152.         URLAccessAvailable() is a macro/inline available only in C/C++.  
  153.         To get the same functionality from pascal or assembly, you need
  154.         to test if URLGetURLAccessVersion function is not NULL.  For instance:
  155.         
  156.             gURLAccessAvailable = FALSE;
  157.             IF @URLAccessAvailable <> kUnresolvedCFragSymbolAddress THEN
  158.                 gURLAccessAvailable = TRUE;
  159.             END
  160.     
  161.     }
  162. {$ENDC}  {TARGET_RT_MAC_CFM}
  163.  
  164.  
  165. TYPE
  166. {$IFC TYPED_FUNCTION_POINTERS}
  167.     URLNotifyProcPtr = FUNCTION(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo): OSStatus;
  168. {$ELSEC}
  169.     URLNotifyProcPtr = ProcPtr;
  170. {$ENDC}
  171.  
  172. {$IFC TYPED_FUNCTION_POINTERS}
  173.     URLSystemEventProcPtr = FUNCTION(userContext: UNIV Ptr; VAR event: EventRecord): OSStatus;
  174. {$ELSEC}
  175.     URLSystemEventProcPtr = ProcPtr;
  176. {$ENDC}
  177.  
  178.     URLNotifyUPP = UniversalProcPtr;
  179.     URLSystemEventUPP = UniversalProcPtr;
  180.  
  181. CONST
  182.     uppURLNotifyProcInfo = $00000FF0;
  183.     uppURLSystemEventProcInfo = $000003F0;
  184.  
  185. FUNCTION NewURLNotifyUPP(userRoutine: URLNotifyProcPtr): URLNotifyUPP; { old name was NewURLNotifyProc }
  186.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  187.     INLINE $2E9F;
  188.     {$ENDC}
  189.  
  190. FUNCTION NewURLSystemEventUPP(userRoutine: URLSystemEventProcPtr): URLSystemEventUPP; { old name was NewURLSystemEventProc }
  191.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  192.     INLINE $2E9F;
  193.     {$ENDC}
  194.  
  195. PROCEDURE DisposeURLNotifyUPP(userUPP: URLNotifyUPP);
  196.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  197.     INLINE $594F;
  198.     {$ENDC}
  199.  
  200. PROCEDURE DisposeURLSystemEventUPP(userUPP: URLSystemEventUPP);
  201.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  202.     INLINE $594F;
  203.     {$ENDC}
  204.  
  205. FUNCTION InvokeURLNotifyUPP(userContext: UNIV Ptr; event: URLEvent; VAR callbackInfo: URLCallbackInfo; userRoutine: URLNotifyUPP): OSStatus; { old name was CallURLNotifyProc }
  206.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  207.     INLINE $205F, $4E90;
  208.     {$ENDC}
  209.  
  210. FUNCTION InvokeURLSystemEventUPP(userContext: UNIV Ptr; VAR event: EventRecord; userRoutine: URLSystemEventUPP): OSStatus; { old name was CallURLSystemEventProc }
  211.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  212.     INLINE $205F, $4E90;
  213.     {$ENDC}
  214. FUNCTION URLSimpleDownload(url: ConstCStringPtr; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  215. FUNCTION URLDownload(urlRef: URLReference; VAR destination: FSSpec; destinationHandle: Handle; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  216. FUNCTION URLSimpleUpload(url: ConstCStringPtr; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  217. FUNCTION URLUpload(urlRef: URLReference; {CONST}VAR source: FSSpec; openFlags: URLOpenFlags; eventProc: URLSystemEventProcPtr; userContext: UNIV Ptr): OSStatus;
  218. FUNCTION URLNewReference(url: ConstCStringPtr; VAR urlRef: URLReference): OSStatus;
  219. FUNCTION URLDisposeReference(urlRef: URLReference): OSStatus;
  220. FUNCTION URLOpen(urlRef: URLReference; VAR fileSpec: FSSpec; openFlags: URLOpenFlags; notifyProc: URLNotifyProcPtr; eventRegister: URLEventMask; userContext: UNIV Ptr): OSStatus;
  221. FUNCTION URLAbort(urlRef: URLReference): OSStatus;
  222. FUNCTION URLGetDataAvailable(urlRef: URLReference; VAR dataSize: Size): OSStatus;
  223. FUNCTION URLGetBuffer(urlRef: URLReference; VAR buffer: UNIV Ptr; VAR bufferSize: Size): OSStatus;
  224. FUNCTION URLReleaseBuffer(urlRef: URLReference; buffer: UNIV Ptr): OSStatus;
  225. FUNCTION URLGetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
  226. FUNCTION URLGetPropertySize(urlRef: URLReference; property: ConstCStringPtr; VAR propertySize: Size): OSStatus;
  227. FUNCTION URLSetProperty(urlRef: URLReference; property: ConstCStringPtr; propertyBuffer: UNIV Ptr; bufferSize: Size): OSStatus;
  228. FUNCTION URLGetCurrentState(urlRef: URLReference; VAR state: URLState): OSStatus;
  229. FUNCTION URLGetError(urlRef: URLReference; VAR urlError: OSStatus): OSStatus;
  230. FUNCTION URLIdle: OSStatus;
  231. FUNCTION URLGetFileInfo(fName: StringPtr; VAR fType: OSType; VAR fCreator: OSType): OSStatus;
  232.  
  233. { Error Codes }
  234.  
  235. CONST
  236.     kURLInternetAccessErrorCodeBase = -30770;
  237.     kURLInvalidURLReferenceError = -30770;
  238.     kURLProgressAlreadyDisplayedError = -30771;
  239.     kURLDestinationExistsError    = -30772;
  240.     kURLInvalidURLError            = -30773;
  241.     kURLUnsupportedSchemeError    = -30774;
  242.     kURLServerBusyError            = -30775;
  243.     kURLAuthenticationError        = -30776;
  244.     kURLPropertyNotYetKnownError = -30777;
  245.     kURLUnknownPropertyError    = -30778;
  246.     kURLPropertyBufferTooSmallError = -30779;
  247.     kURLUnsettablePropertyError    = -30780;
  248.     kURLInvalidCallError        = -30781;
  249.     kURLFileEmptyError            = -30783;
  250.     kURLExtensionFailureError    = -30785;
  251.     kURLInvalidConfigurationError = -30786;
  252.     kURLAccessNotAvailableError    = -30787;
  253.     kURL68kNotSupportedError    = -30788;
  254.  
  255. {$ALIGN RESET}
  256. {$POP}
  257.  
  258. {$SETC UsingIncludes := URLAccessIncludes}
  259.  
  260. {$ENDC} {__URLACCESS__}
  261.  
  262. {$IFC NOT UsingIncludes}
  263.  END.
  264. {$ENDC}
  265.